@extends("layouts.backend.webadmin")
@section('page-header')
    <h1>
        <small>falw\menu</small>
    </h1>
@endsection

@section('content')
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body">
                        @if($errors->any())
                            <ul class="alert alert-danger">
                                @foreach($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        @endif
                        @if($action =='add')
                        <form action="{{ URL::route('admin.flaw.leveladd') }}" method="POST">
                        @elseif($action =='update')
                        <form action="{{ URL::route('admin.flaw.levelupdate') }}" method="POST">
                        <input type="hidden" name="id" value="{{$item->id}}">
                        @endif
                        <div class="form-group">
                            <label for="levelname">名称</label>
                            <input type="text" class="form-control" id="levelname" placeholder="等级名称"
                                   name="name" @if($action =='update') value="{{$item->name}}"
                                   @else value="{{old('name')}}" @endif>
                        </div>
                        <div class="form-group">
                            <label for="leveltext">等级</label>
                            <input type="text" class="form-control" id="leveltext" placeholder="等级" name="level" @if($action =='update')value="{{$item->level}}" @else value="{{old('level')}}" @endif>
                        </div>
                        <div class="form-group">
                            <label for="minreward">最少安全币</label>
                            <input type="text" class="form-control" id="minreward" placeholder="最少安全币"
                                   name="min_reward"
                                   @if($action =='update')value="{{$item->min_reward}} @else value="{{old('min_reward')}}" @endif">
                        </div>
                        <div class="form-group">
                            <label for="maxreward">最大安全币</label>
                            <input type="text" class="form-control" id="maxreward" placeholder="最大安全币"
                                   name="max_reward"
                                   @if($action =='update')value="{{$item->max_reward}} @else value="{{old('max_reward')}}" @endif">
                        </div>
                        <div class="form-group">
                            <label for="mininteg">最少积分</label>
                            <input type="text" class="form-control" id="mininteg" placeholder="最少积分"
                                   name="min_integ"
                                   @if($action =='update')value="{{$item->min_integ}} @else value="{{old('min_integ')}}" @endif">
                        </div>
                        <div class="form-group">
                            <label for="maxinteg">最多积分</label>
                            <input type="number" class="form-control" id="maxinteg" placeholder="最多积分"
                                   name="max_integ"
                                   @if($action =='update')value="{{$item->max_integ}}" @else value="{{old('max_integ')}}" @endif>
                        </div>
                        <div class="form-group form_datetime">
                            <label for="termoption">期限</label>
{{--                            <div class="input-group">
                                <div class="input-group-addon">
                                    <i class="fa fa-calendar"></i>
                                </div>--}}
                                <input type="number" class="form-control pull-left" id="termoption"
                                       placeholder="期限" name="term"
                                       @if($action =='update')value="{{$item->term}}@else value="{{old('term')}}" @endif">
{{--                            </div>--}}
                        </div>
                        <div class="form-group">
                            <label>描述</label>
                            <textarea class="form-control" rows="3" placeholder="相关描述..."
                                      name="description"> @if($action =='update'){{$item->description}} @else {{old('description')}} @endif</textarea>
                        </div>
                        {!! csrf_field() !!}
                        @if($action =='add')
                            <button type="submit" class="btn btn-default">添加</button>
                        @else
                            <button type="submit" class="btn btn-default">更新</button>
                        @endif
                        </form>
                        <script>
/*                            $(function () {
                                $('#termoption').daterangepicker({
                                    autoclose: true,
                                    todayBtn: true,
                                    todayHighlight: true,
                                    startDate: moment()
                                })
                            })*/
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </section>
@stop